Location: Carbon Dioxide pH/Gas Transport and Exchange @ afeeca156d18 / WagnerCano SS Respiration-driven 2020-01-19.txt

Author:
aram148 <42922407+aram148@users.noreply.github.com>
Date:
2022-07-19 16:08:46+12:00
Desc:
Added CO2 exchange and pH bg models
Permanent Source URI:
https://models.cellml.org/workspace/8c0/rawfile/afeeca156d18d9435303b544ea071f7cf868595d/WagnerCano SS Respiration-driven 2020-01-19.txt

def model my_model as
    // Wagner-Cano SS respiratory model 

    def unit dim as
        unit dimensionless;
    enddef;

    def unit per_s as
        unit second {expo: -1};
    enddef;

    def unit per_L as
        unit liter {expo: -1};
    enddef;

    def unit per_mmol as
        unit mole {pref: milli, expo: -1};
    enddef;

    def unit per_J as
        unit joule {expo: -1};
    enddef;

    def unit L_per_s as
        unit litre;
        unit per_s;
    enddef;

    def unit L_per_mmol as
        unit litre;
        unit per_mmol;
    enddef;

    def unit mmol_per_s as
        unit mole {pref: milli};
        unit per_s;
    enddef;

    def unit mmol_per_L as
        unit mole {pref: milli};
        unit per_L;
    enddef;

    def unit kPa as
        unit joule;
        unit per_L;
    enddef;

    def unit mmol_per_s_per_kPa as
        unit mole {pref: milli};
        unit per_s;
        unit kPa {expo: -1};
    enddef;

    def comp main as
        var t: dim {init: 0};
        var V_In_air: L_per_s {init: 0};
        var V_In_air_max: L_per_s {init: 1};
        var F_In_o2: dim {init: 0.2093};
        var f_o2: L_per_mmol {init: 22.4e-3};
        var P_B: kPa {init: 101.33};
        var V_b: L_per_s {init: 0.383};
        var D_l_o2: mmol_per_s_per_kPa {init: 28.46};
        var D_m_o2: mmol_per_s_per_kPa {init: 0.5692};
        var Q_m_o2max: mmol_per_s {init: 2.842}
        var p_m_50: kPa {init: 0.03333};
        var p_l_o2: kPa;
        var Q_l_o2: mmol_per_s;
        var Q_m_o2: mmol_per_s;
        var p_lc_o2: kPa;
        var p_mc_o2: kPa;
        var p_m_o2: kPa;
        var C_lc_o2: mmol_per_L;
        var C_mc_o2: mmol_per_L;
        var C_o2_max: mmol_per_L {init: 8.615};
        var p_50_o2: kPa {init: 3.573};
        var n: dim {init: 3};
        var Ventilation: mmol_per_s;
        var VentilationPerfusionRatio: dimensionless;

        ode(V_In_air, t) = 1.0{dim}*V_In_air_max;
        Q_l_o2 = V_In_air*(F_In_o2-p_l_o2/P_B)/f_o2;
        Q_l_o2 = D_l_o2*(p_l_o2-p_lc_o2);
        Q_l_o2 = V_b*(C_lc_o2-C_mc_o2);
        Q_l_o2 = Q_m_o2;
        Q_m_o2 = D_m_o2*(p_mc_o2-p_m_o2);
        C_lc_o2 = C_o2_max*pow(p_lc_o2, n)/(pow(p_50_o2, n)+pow(p_lc_o2, n));
        C_mc_o2 = C_o2_max*pow(p_mc_o2, n)/(pow(p_50_o2, n)+pow(p_mc_o2, n));
        Q_m_o2 = Q_m_o2max*p_m_o2/(p_m_50+p_m_o2);
        Ventilation = V_In_air*F_In_o2/f_o2;
        VentilationPerfusionRatio = Ventilation/Q_l_o2;

        //C_lc_o2 = C_o2_max*p_lc_o2/(p_50_o2+p_lc_o2);
        //C_mc_o2 = C_o2_max*p_mc_o2/(p_50_o2+p_mc_o2);        
    enddef;
enddef;